package com.itita.ww2.handler.requesthandler.game;

import java.sql.SQLException;

import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;
import com.itita.ww2.core.MessageHandler;
import com.itita.ww2.core.WW2Exception;
import com.itita.ww2.utils.handler.IRequestOper;

/**
 * 心跳
 * 回传一个时间进行校正
 * @author NorthLan
 *
 */
public class HeartBeat implements IRequestOper {

	@Override
	public boolean execute(String requestCMD, User user, ISFSObject params) throws WW2Exception, SQLException {
		ISFSObject backObj = new SFSObject();
		backObj.putLong("time", DateTime.now(DateTimeZone.UTC).getMillis());
		MessageHandler.getInstance().sendMsg(requestCMD, backObj, user, null, true);
		return true;
	}

}
